package com.codermn.test;

import java.util.concurrent.*;

/**
 * @author jxau_scf
 * @date 2021/6/22 - 11:04
 */
public class ThreadPoolDemo {
    public static void main(String[] args) {
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
                3,
                6,
                1L,
                TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(3),
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.AbortPolicy());

        for (int i = 0;i < 8;i++){
            threadPoolExecutor.execute(new Runnable() {
                @Override
                public void run() {
                    System.out.println(Thread.currentThread().getName()+"正在办理业务");
                }
            });
        }
        threadPoolExecutor.shutdown();
    }
}
